package com.zhangyu.shadow.repair.delegate.history.detail;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhangyu.shadow.repair.R;
import com.zhangyu.shadow.repair.delegate.bean.PersonBean;
import com.zhangyu.shadow.repair.delegate.bean.TempWorkBean;

import java.util.List;

/**
 * @author zhangyu
 * @date 2018/12/6
 */

public class HistoryWorkAdapter extends BaseQuickAdapter<TempWorkBean, BaseViewHolder> {
    public HistoryWorkAdapter(int layoutResId, @Nullable List<TempWorkBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, TempWorkBean item) {
        List<PersonBean> personBeans = item.getPersons();
        StringBuilder person = new StringBuilder("");
        if (personBeans != null && !personBeans.isEmpty()) {
            for (PersonBean personBean : personBeans) {
                person.append(personBean.getName()).append("/");
            }
            helper.setText(R.id.tv_person, person.toString().substring(0, person.toString().length() - 1));
        }
        helper.setText(R.id.tv_name, item.getName());
        helper.setText(R.id.tv_content, item.getValue());
    }
}
